<#include "../common/_header.htm">
<div id="hidebox" >
    <div class="box-body">
		<table id="dg"></table>
	</div>
</div>
<script>
	window.onload = firstTable;
	function firstTable(){
		/** 回去传值 **/
		var dialog = top.dialog.get(window);
		var dealFlowUuid = dialog.data.dealFlowUuid; // 获取对话框传递过来的数据
		var caseManagerId = dialog.data.caseManagerId; // 获取对话框传递过来的数据
		if (!caseManagerId) {
			toastr.error("案件id为空");
			return;
		}
		$('#dg').datagrid({
			url: '${ctx}/bill/stream/inaccountstatistics_detail',
			method: 'post',
			iconCls: 'icon-save',
			queryParams:{//每次请求的参数
				uuid : dealFlowUuid,
				casemanageId : caseManagerId
			},
			height:($(window).height())-60,
			pageList:[10,20,40,50,100],//每页记录数选择范围设置
			pageNumber:1,//当前页号,
			pageSize:20,//每页显示记录数
			loadMsg:"正在加载，请稍后",//加载数据时的提示信息
			emptyMsg:"暂无信息",//加载数据为空时的信息
			rownumbers:true,//序号
			fitColumns: true,//使表格自适应页面宽度
			pagination: true,//是否分页
			singleSelect: true,
			columns:[[ //每一列的具体设置。
				{field:'ACCOUNT_BODY',title:'交易主体'},
				{field:'ACCOUNT_BODY_NUMBER',title:'交易主体账号'},
				{field:'ACCOUNT_BODY_CARD',title:'交易主体卡号'},
				{field:'ACCOUNT_RIVAL',title:'交易对手'},
				{field:'ACCOUNT_RIVAL_NUMBER',title:'交易对手账号'},
				{field:'ACCOUNT_RIVAL_CARD',title:'交易对手卡号'},
				{field:'SIGN',title:'交易类型',
					formatter: function(value,row,index){ //当前值，当前的row，当前的索引
						return value==0?'流入':'流出'
					}
				},
				{field:'TRADE_DATE',title:'交易时间',
					formatter: function(value,row,index){ //当前值，当前的row，当前的索引
						if(value){
							var date = new Date(value);
							return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
						}else{
							return '-';
						}
					}
				},
				{field:'ACCOUNT_MONEY',title:'交易金额', sortable : true},
				{field:'SURPLUS_MONEY',title:'交易后余额', sortable : true},
				{field:'CONTENT_ABSTRACT',title:'摘要'},
				{field:'ACCOUNT_RIVAL_BANK',title:'对手归属行'},
				{field:'ACCOUNT_BODY_BANK',title:'主体归属行'},
				{field:'INSTITUTION_NUMBER',title:'对方机构号'},
				{field:'TELLER_NUMBER',title:'柜员号'},
				{field:'REMARKS',title:'备注'}
			]],
            onHeaderContextMenu: function(e, field){
                e.preventDefault();
                if (!cmenu){
                    createColumnMenu();
                }
                cmenu.menu('show', {
                    left:e.pageX,
                    top:e.pageY
                });
            }
		});
	};
	/*列显示下拉框*/
    var cmenu;
    function createColumnMenu(){
        cmenu = $('<div/>').appendTo('body');
        cmenu.menu({
            onClick: function(item){
                if (item.iconCls == 'icon-ok'){
                    $('#dg').datagrid('hideColumn', item.name);
                    cmenu.menu('setIcon', {
                        target: item.target,
                        iconCls: 'icon-empty'
                    });
                } else {
                    $('#dg').datagrid('showColumn', item.name);
                    cmenu.menu('setIcon', {
                        target: item.target,
                        iconCls: 'icon-ok'
                    });
                }
            }
        });
        var fields = $('#dg').datagrid('getColumnFields');
        for(var i=0; i<fields.length; i++){
            var field = fields[i];
            var col = $('#dg').datagrid('getColumnOption', field);
            cmenu.menu('appendItem', {
                text: col.title,
                name: field,
                iconCls: 'icon-ok'
            });
        }
    };
</script>
<style>
	#hidebox {
	   top: 23px;
	   left: 2%;
	   border-radius: 5px;
	   background-color:#fff;
	   z-Index:9999;
	   padding: 10px;
	   overflow:hidden;
	   height:100%;
	   width:100%；
	}
</style>
</body>
</html>
